package com.wisdytech.linkdcs.equipment.service.impl;

import com.github.pagehelper.PageInfo;
import com.wisdytech.common.bean.Filter;
import com.wisdytech.common.handler.BaseService;
import com.wisdytech.linkdcs.equipment.dao.IEqAlarmRecordDao;
import com.wisdytech.linkdcs.equipment.dao.IEqEquipAlarmParamDao;
import com.wisdytech.linkdcs.equipment.model.AlarmRecord;
import com.wisdytech.linkdcs.equipment.model.EquipAlarmParam;
import com.wisdytech.linkdcs.equipment.service.IEquipmentAlarmService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("equipmentAlarmService")
@Transactional
public class EquipmentAlarmServiceImpl extends BaseService<IEqEquipAlarmParamDao, EquipAlarmParam> implements IEquipmentAlarmService {



    @Override
    public PageInfo<AlarmRecord> listAlarmRecord(Filter filter, String eqCode, String startTime, String endTime) {
        
        Map<String,Object> params=new HashMap<>();
        
        if(StringUtils.isNotBlank(eqCode)){
            params.put("eqCode", eqCode);
        }
        if(StringUtils.isNotBlank(startTime)){
            params.put("startTime", startTime);
        }
        if(StringUtils.isNotBlank(endTime)){
            params.put("endTime", endTime);
        }

        List<AlarmRecord> lists=
                super.beforeList(IEqAlarmRecordDao.class, filter).listAlarmRecords(params);
        PageInfo<AlarmRecord> pageInfo =new PageInfo<>(lists);
        return pageInfo;
    }


    
    

}
